<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="vue.js"></script>
    <title>多个组件过渡</title>
</head>
<body>
    <template id="examplel">
        <span>我是登陆组件</span>
    </template>
    <template id="example2">
        <span>我是注册组件</span>
    </template>
    <div id="app">
        <a href="javascript:;" @click="compontentName='examplel'">登陆</a>
        <a href="javascript:;" @click="compontentName='example2'">注册</a>
        <transition name="fade" made="in-out">
            <component :is="compontentName"></component>
        </transition>
    </div>
    <script>
        Vue.component('examplel',{template:'#examplel'})
        Vue.component('example2',{template:'#example2'})
        var vm=new Vue({
            el:'#app',
            data:{compontentName:''}
        })
    </script>
    <style>
        .fade-enter-active,.fade-leave-active{
            transition: opacity .5s ease;
        }
        .fade-enter,.fade-leave-to{
            opacity: 0;
        }
    </style>
</body>
</html>